package com.genokon.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.genokon.dto.OrderSampleDto;
import com.genokon.service.OrderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author by baichaoda
 * @date 2021/4/20 10:33
 */
@RestController
@RequestMapping("/serviceOrder")
public class OrderController {
    @Resource
    private OrderService orderService;

    @PostMapping("/add")
    R<Integer> addVariation(@RequestBody OrderSampleDto dto){
        R<Integer> result;
        try {
            result = R.ok(orderService.addOrderInfo(dto));
        } catch (Exception e) {
            result = R.failed(e.getMessage());
        }
        return result;
    }
}
